#include <iostream>
#include <queue>
#define LL long long
using namespace std;

const int kMaxN = 5100;
const LL kInf = 1e18;

LL f[2][kMaxN];
int a[kMaxN];

LL DP(int n, int k, int x) {
  int last = 0, now = 1;
  fill(f[0], f[0] + n + 1, -kInf);
  f[0][0] = 0;
  for (int i = 1; i <= x; i++) {
    deque<int> deq;

    fill(f[now], f[now] + n + 1, -kInf);
    for (int j = 1; j <= n; j++) {
      if (f[last][j - 1] != -kInf) {
        for (; !deq.empty() && f[last][deq.back()] <= f[last][j - 1]; deq.pop_back());
        deq.push_back(j - 1);
      }
      if (!deq.empty())
        f[now][j] = max(f[now][j], f[last][deq.front()] + a[j]);
      if (!deq.empty() && deq.front() + k == j) {
        deq.pop_front();
      }
    }
    swap(last, now);
  }

  LL ans = -1;
  for (int i = n; i > n - k; i--) {
    ans = max(ans, f[last][i]);
  }
  return ans;
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, k, x;

  cin >> n >> k >> x;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  cout << DP(n, k, x) << "\n";
  return 0;
}